1. Technical Field
The present invention relates to passing null references between software components and, in particular, to passing null references between a null-capable software component and a component that is not null-capable. More particularly, the present invention passes null references using sentinel values.
2. Description of Related Art
Application frameworks communicate with persistent data stores to retrieve application-specific data. In a client-server environment, clients typically are implemented using programming models, such as common object architecture the Common Object Request Broker Architecture (CORBA(trademark)) programming model, to communicate with application servers to persist application-specific information backend databases. The CORBA(trademark) programming model is a standard from the Object Management Group (OMG) for communicating between distributed objects. Objects are self-contained software modules. The CORBA(trademark) programming model provides a way to execute objects written in different programming languages running on different platforms no matter where they reside in the network. The CORBA(trademark) programming model is often described as an xe2x80x9cobject busxe2x80x9d or xe2x80x9csoftware bus,xe2x80x9d because it is a software-based communications interface through which objects are located and accessed.
The application servers that the applications run on typically provide xe2x80x9ccontainersxe2x80x9d that transfer information between a persistent backend and the application logic. In cases where the application logic is implemented using an objected-oriented paradigm, application-specific information may be in the form of primitive data types or more complex object types. For object types that need to be persisted, a common value to be stored is a xe2x80x9cnullxe2x80x9d value. For a null value, the object is not created. An xe2x80x9cobjectxe2x80x9d is any data that can exist and have a state, meaning primitive types as well as, but distinct from class instances.
Some recent databases, such as the Database 2(trademark) database from International Business Machines Corporation, are null-capable, meaning they are capable of storing null values. However, many legacy backend systems, such as applications written in Customer Information Control System (CICS(trademark)) and Information Management System (IMS(trademark)) programming models from IBM, are not null-capable. The use of legacy backend systems that are not null-capable creates a problem in deploying null-capable client applications that need to persist null values in the legacy systems.
Conversely, certain programming models, such as clients using the legacy CORBA(trademark) programming model, are not null-capable. Client applications written in programming models that are not null-capable cannot retrieve data from null-capable backend systems.
Additionally, certain legacy application frameworks, referred to as xe2x80x9ccontainersxe2x80x9d or xe2x80x9cglue code,xe2x80x9d that provide communication between server applications and data stores do not support null values. The use of glue code that is not null-capable creates a problem, even for null-capable client applications that attempt to persist data in null-capable databases.
Therefore, it would be advantageous to have a method and apparatus for passing null references between software components through a legacy framework.
The present invention allows software components to agree on sentinel values. When a software component attempts to pass a null value to a software component that does not support null values, an intermediate framework replaces the null value with a corresponding sentinel value. When a software component that is not null-capable attempts to pass a sentinel value to a null-capable software component, the intermediate framework replaces the sentinel with a null value. The sentinel values may be randomly generated or assigned by a user. A sentinel value is a valid data value that is never used during program execution. For example, for an integer sentinel value one would not use a fraction or floating point number, but one would use an integer, such as 9999, that will never be used during regular program execution.